// react + ts
import { useState } from 'react'

type User = {
  name: string,
  age: number
}
function App() {
  // 1. 初始值为 null
  const [user, setUser] = useState<User | null>(null)

  const changeUser = () => {
    setUser(null)
    setUser({
      name: 'lisi',
      age: 20
    })
  }
  
  return (
    <>
      this is app, {user?.name}
    </>
  )
}

export default App
